#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import os
import ppc
import ppc.task


def main():
    argv = ppc.CmdlineArguments()
    if not argv[0]:
        print('usage: python main.py taskname [options]')
        exit(1)

    if argv['daemon']:
        ppc.daemonize()

    task = ppc.task.Task(argv[0])
    task.parse()
    task.run()


if __name__ == "__main__":
    main()
